package Solutions

func fileCombination(target int) [][]int {
	sum := 0
	left := 1
	ans := make([][]int, 0)
	for i := 1; i <= (target+1)/2; i++ {
		sum += i
		if sum > target {
			for sum > target {
				sum -= left
				left++
			}
		}
		if sum == target {
			t := make([]int, 0, i-left+1)
			for j := left; j <= i; j++ {
				t = append(t, j)
			}
			ans = append(ans, t)
		}
	}
	return ans
}
